


/*
'===============================================================================
'  HNG.Portal.BL.TblTinTucManagerBase
'===============================================================================
*/

using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using HNG.Portal.BLL;
using HNG.Portal.DAL;
using HNG.Portal.DAL.EntityClasses;
using HNG.Portal.DAL.FactoryClasses;
using HNG.Portal.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
using System.Windows.Forms;
namespace HNG.Portal.BLL
{
	public class TblTinTucManagerBase
	{
	    
		#region ColumnNames
		
				public const String Field_Id="Id";
				
				public const String Field_LangId="LangId";
				
				public const String Field_NhomTinId="NhomTinId";
				
				public const String Field_DanhMucTinId="DanhMucTinId";
				
				public const String Field_TenDanhMuc="TenDanhMuc";
				
				public const String Field_TenLoaiDanhMuc="TenLoaiDanhMuc";
				
				public const String Field_KieuTin="KieuTin";
				
				public const String Field_StrKieuTin="StrKieuTin";
				
				public const String Field_TieuDe="TieuDe";
				
				public const String Field_TomTat="TomTat";
				
				public const String Field_Mota="Mota";
				
				public const String Field_Image="Image";
				
				public const String Field_NgayDang="NgayDang";
				
				public const String Field_TinHot="TinHot";
				
				public const String Field_TinNoiBat="TinNoiBat";
				
				public const String Field_TruyCap="TruyCap";
				
				public const String Field_TrangThai="TrangThai";
				
		#endregion	
		/// <summary>
		/// Purpose: Class constructor.
		/// </summary>
		public TblTinTucManagerBase()
		{
			// Nothing for now.
		}
		public DataTable Clone()
		{
			DataTable dt = new DataTable();
						
			
			dt.Columns.Add(Field_Id,typeof(int));
			
						
			
			dt.Columns.Add(Field_LangId,typeof(string));
			
						
			
			dt.Columns.Add(Field_NhomTinId,typeof(int));
			
						
			
			dt.Columns.Add(Field_DanhMucTinId,typeof(int));
			
						
			
			dt.Columns.Add(Field_TenDanhMuc,typeof(string));
			
						
			
			dt.Columns.Add(Field_TenLoaiDanhMuc,typeof(string));
			
						
			
			dt.Columns.Add(Field_KieuTin,typeof(bool));
			
						
			
			dt.Columns.Add(Field_StrKieuTin,typeof(string));
			
						
			
			dt.Columns.Add(Field_TieuDe,typeof(string));
			
						
			
			dt.Columns.Add(Field_TomTat,typeof(string));
			
						
			
			dt.Columns.Add(Field_Mota,typeof(string));
			
						
			
			dt.Columns.Add(Field_Image,typeof(string));
			
						
			
			dt.Columns.Add(Field_NgayDang,typeof(DateTime));
			
						
			
			dt.Columns.Add(Field_TinHot,typeof(bool));
			
						
			
			dt.Columns.Add(Field_TinNoiBat,typeof(bool));
			
						
			
			dt.Columns.Add(Field_TruyCap,typeof(int));
			
						
			
			dt.Columns.Add(Field_TrangThai,typeof(bool));
			
			            
            return dt;			
		}
			
		public TblTinTucEntity Convert_Entity(TblTinTucEntity _TblTinTucEntity,TblTinTucEntity _TblTinTucEntity_XML)
		{	
			
				
			_TblTinTucEntity.Id= _TblTinTucEntity_XML.Id;
				
			_TblTinTucEntity.LangId= _TblTinTucEntity_XML.LangId;
				
			_TblTinTucEntity.NhomTinId= _TblTinTucEntity_XML.NhomTinId;
				
			_TblTinTucEntity.DanhMucTinId= _TblTinTucEntity_XML.DanhMucTinId;
				
			_TblTinTucEntity.TenDanhMuc= _TblTinTucEntity_XML.TenDanhMuc;
				
			_TblTinTucEntity.TenLoaiDanhMuc= _TblTinTucEntity_XML.TenLoaiDanhMuc;
				
			_TblTinTucEntity.KieuTin= _TblTinTucEntity_XML.KieuTin;
				
			_TblTinTucEntity.StrKieuTin= _TblTinTucEntity_XML.StrKieuTin;
				
			_TblTinTucEntity.TieuDe= _TblTinTucEntity_XML.TieuDe;
				
			_TblTinTucEntity.TomTat= _TblTinTucEntity_XML.TomTat;
				
			_TblTinTucEntity.Mota= _TblTinTucEntity_XML.Mota;
				
			_TblTinTucEntity.Image= _TblTinTucEntity_XML.Image;
				
			_TblTinTucEntity.NgayDang= _TblTinTucEntity_XML.NgayDang;
				
			_TblTinTucEntity.TinHot= _TblTinTucEntity_XML.TinHot;
				
			_TblTinTucEntity.TinNoiBat= _TblTinTucEntity_XML.TinNoiBat;
				
			_TblTinTucEntity.TruyCap= _TblTinTucEntity_XML.TruyCap;
				
			_TblTinTucEntity.TrangThai= _TblTinTucEntity_XML.TrangThai;
				
			
			return _TblTinTucEntity;
		}	
		
			
		public void InsertCollection(EntityCollection _Collection)
		{
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                adapter.SaveEntityCollection(_Collection);
            }
		}

		public TblTinTucEntity Insert(TblTinTucEntity TblTinTucEntity)
		{
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.SaveEntity(TblTinTucEntity, true);
			}
			return TblTinTucEntity;
		}

		
		public TblTinTucEntity Insert(int Id, string LangId, int NhomTinId, int DanhMucTinId, string TenDanhMuc, string TenLoaiDanhMuc, bool KieuTin, string StrKieuTin, string TieuDe, string TomTat, string Mota, string Image, DateTime NgayDang, bool TinHot, bool TinNoiBat, int TruyCap, bool TrangThai)
		{
			TblTinTucEntity _TblTinTucEntity = new TblTinTucEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_TblTinTucEntity.Id = Id;
				_TblTinTucEntity.LangId = LangId;
				_TblTinTucEntity.NhomTinId = NhomTinId;
				_TblTinTucEntity.DanhMucTinId = DanhMucTinId;
				_TblTinTucEntity.TenDanhMuc = TenDanhMuc;
				_TblTinTucEntity.TenLoaiDanhMuc = TenLoaiDanhMuc;
				_TblTinTucEntity.KieuTin = KieuTin;
				_TblTinTucEntity.StrKieuTin = StrKieuTin;
				_TblTinTucEntity.TieuDe = TieuDe;
				_TblTinTucEntity.TomTat = TomTat;
				_TblTinTucEntity.Mota = Mota;
				_TblTinTucEntity.Image = Image;
				_TblTinTucEntity.NgayDang = NgayDang;
				_TblTinTucEntity.TinHot = TinHot;
				_TblTinTucEntity.TinNoiBat = TinNoiBat;
				_TblTinTucEntity.TruyCap = TruyCap;
				_TblTinTucEntity.TrangThai = TrangThai;
				adapter.SaveEntity(_TblTinTucEntity, true);
			}
			return _TblTinTucEntity;
		}

		public TblTinTucEntity Insert(string LangId, int NhomTinId, int DanhMucTinId, string TenDanhMuc, string TenLoaiDanhMuc, bool KieuTin, string StrKieuTin, string TieuDe, string TomTat, string Mota, string Image, DateTime NgayDang, bool TinHot, bool TinNoiBat, int TruyCap, bool TrangThai)
		{
			TblTinTucEntity _TblTinTucEntity = new TblTinTucEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_TblTinTucEntity.LangId = LangId;
				_TblTinTucEntity.NhomTinId = NhomTinId;
				_TblTinTucEntity.DanhMucTinId = DanhMucTinId;
				_TblTinTucEntity.TenDanhMuc = TenDanhMuc;
				_TblTinTucEntity.TenLoaiDanhMuc = TenLoaiDanhMuc;
				_TblTinTucEntity.KieuTin = KieuTin;
				_TblTinTucEntity.StrKieuTin = StrKieuTin;
				_TblTinTucEntity.TieuDe = TieuDe;
				_TblTinTucEntity.TomTat = TomTat;
				_TblTinTucEntity.Mota = Mota;
				_TblTinTucEntity.Image = Image;
				_TblTinTucEntity.NgayDang = NgayDang;
				_TblTinTucEntity.TinHot = TinHot;
				_TblTinTucEntity.TinNoiBat = TinNoiBat;
				_TblTinTucEntity.TruyCap = TruyCap;
				_TblTinTucEntity.TrangThai = TrangThai;
				adapter.SaveEntity(_TblTinTucEntity, true);
			}
			return _TblTinTucEntity;
		}

		public bool Update(TblTinTucEntity _TblTinTucEntity)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				RelationPredicateBucket filter = new RelationPredicateBucket();
				IPredicateExpression _PredicateExpression = new PredicateExpression();
				_PredicateExpression.Add(TblTinTucFields.Id == _TblTinTucEntity.Id);
					
				filter.PredicateExpression.Add(_PredicateExpression);

				adapter.UpdateEntitiesDirectly(_TblTinTucEntity, filter);
				toReturn = true;
			}
			return toReturn;
		}
		
		public bool Update(TblTinTucEntity _TblTinTucEntity, RelationPredicateBucket filter)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.UpdateEntitiesDirectly(_TblTinTucEntity, filter);
				toReturn = true;
			}
			return toReturn;
		}

		public bool Update(int Id, string LangId, int NhomTinId, int DanhMucTinId, string TenDanhMuc, string TenLoaiDanhMuc, bool KieuTin, string StrKieuTin, string TieuDe, string TomTat, string Mota, string Image, DateTime NgayDang, bool TinHot, bool TinNoiBat, int TruyCap, bool TrangThai)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				TblTinTucEntity _TblTinTucEntity = new TblTinTucEntity(Id);
				if (adapter.FetchEntity(_TblTinTucEntity))
				{
				
					_TblTinTucEntity.LangId = LangId;
					_TblTinTucEntity.NhomTinId = NhomTinId;
					_TblTinTucEntity.DanhMucTinId = DanhMucTinId;
					_TblTinTucEntity.TenDanhMuc = TenDanhMuc;
					_TblTinTucEntity.TenLoaiDanhMuc = TenLoaiDanhMuc;
					_TblTinTucEntity.KieuTin = KieuTin;
					_TblTinTucEntity.StrKieuTin = StrKieuTin;
					_TblTinTucEntity.TieuDe = TieuDe;
					_TblTinTucEntity.TomTat = TomTat;
					_TblTinTucEntity.Mota = Mota;
					_TblTinTucEntity.Image = Image;
					_TblTinTucEntity.NgayDang = NgayDang;
					_TblTinTucEntity.TinHot = TinHot;
					_TblTinTucEntity.TinNoiBat = TinNoiBat;
					_TblTinTucEntity.TruyCap = TruyCap;
					_TblTinTucEntity.TrangThai = TrangThai;
					adapter.SaveEntity(_TblTinTucEntity, true);
					toReturn = true;
				}
			}
			return toReturn;
		}

		public bool Delete(int Id)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				TblTinTucEntity _TblTinTucEntity = new TblTinTucEntity(Id);
				if (adapter.FetchEntity(_TblTinTucEntity))
				{
					adapter.DeleteEntity(_TblTinTucEntity);
					toReturn = true;
				}
			}
			return toReturn;
		}
		
		public void DeleteAll() 
		{
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.DeleteEntitiesDirectly("TblTinTucEntity", null);
			}
		}
		
		
		public int DeleteById(int Id)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByLangId(string LangId)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.LangId == LangId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByNhomTinId(int NhomTinId)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.NhomTinId == NhomTinId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByDanhMucTinId(int DanhMucTinId)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.DanhMucTinId == DanhMucTinId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTenDanhMuc(string TenDanhMuc)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TenDanhMuc == TenDanhMuc);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTenLoaiDanhMuc(string TenLoaiDanhMuc)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TenLoaiDanhMuc == TenLoaiDanhMuc);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByKieuTin(bool KieuTin)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.KieuTin == KieuTin);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByStrKieuTin(string StrKieuTin)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.StrKieuTin == StrKieuTin);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTieuDe(string TieuDe)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TieuDe == TieuDe);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTomTat(string TomTat)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TomTat == TomTat);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByMota(string Mota)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.Mota == Mota);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByImage(string Image)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByNgayDang(DateTime NgayDang)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.NgayDang == NgayDang);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTinHot(bool TinHot)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TinHot == TinHot);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTinNoiBat(bool TinNoiBat)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TinNoiBat == TinNoiBat);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTruyCap(int TruyCap)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TruyCap == TruyCap);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTrangThai(bool TrangThai)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TrangThai == TrangThai);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblTinTucEntity", filter);
			}
			return toReturn;
		}
		

		
		public TblTinTucEntity SelectOne(int Id)
		{
			TblTinTucEntity toReturn = null;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				TblTinTucEntity _TblTinTucEntity = new TblTinTucEntity(Id);
				if (adapter.FetchEntity(_TblTinTucEntity))
				{
					toReturn = _TblTinTucEntity;
				}
			}
			return toReturn;
		}

		// Return EntityCollection
		public EntityCollection SelectAll()
		{
			EntityCollection _TblTinTucCollection = new EntityCollection( new TblTinTucEntityFactory());
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, null, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectAllRDT()
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, null, true);
			}
			return toReturn;
		}

		
		// Return EntityCollection
		public EntityCollection SelectById(int Id)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByIdRDT(int Id)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByLangId(string LangId)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.LangId == LangId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByLangIdRDT(string LangId)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.LangId == LangId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByNhomTinId(int NhomTinId)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.NhomTinId == NhomTinId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByNhomTinIdRDT(int NhomTinId)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.NhomTinId == NhomTinId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByDanhMucTinId(int DanhMucTinId)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.DanhMucTinId == DanhMucTinId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByDanhMucTinIdRDT(int DanhMucTinId)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.DanhMucTinId == DanhMucTinId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTenDanhMuc(string TenDanhMuc)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TenDanhMuc == TenDanhMuc);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTenDanhMucRDT(string TenDanhMuc)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TenDanhMuc == TenDanhMuc);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTenLoaiDanhMuc(string TenLoaiDanhMuc)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TenLoaiDanhMuc == TenLoaiDanhMuc);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTenLoaiDanhMucRDT(string TenLoaiDanhMuc)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TenLoaiDanhMuc == TenLoaiDanhMuc);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByKieuTin(bool KieuTin)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.KieuTin == KieuTin);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByKieuTinRDT(bool KieuTin)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.KieuTin == KieuTin);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByStrKieuTin(string StrKieuTin)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.StrKieuTin == StrKieuTin);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByStrKieuTinRDT(string StrKieuTin)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.StrKieuTin == StrKieuTin);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTieuDe(string TieuDe)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TieuDe == TieuDe);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTieuDeRDT(string TieuDe)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TieuDe == TieuDe);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTomTat(string TomTat)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TomTat == TomTat);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTomTatRDT(string TomTat)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TomTat == TomTat);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByMota(string Mota)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.Mota == Mota);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByMotaRDT(string Mota)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.Mota == Mota);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByImage(string Image)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByImageRDT(string Image)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByNgayDang(DateTime NgayDang)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.NgayDang == NgayDang);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByNgayDangRDT(DateTime NgayDang)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.NgayDang == NgayDang);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTinHot(bool TinHot)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TinHot == TinHot);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTinHotRDT(bool TinHot)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TinHot == TinHot);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTinNoiBat(bool TinNoiBat)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TinNoiBat == TinNoiBat);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTinNoiBatRDT(bool TinNoiBat)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TinNoiBat == TinNoiBat);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTruyCap(int TruyCap)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TruyCap == TruyCap);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTruyCapRDT(int TruyCap)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TruyCap == TruyCap);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTrangThai(bool TrangThai)
		{
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TrangThai == TrangThai);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblTinTucCollection, filter, 0, null);
			}
			return _TblTinTucCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTrangThaiRDT(bool TrangThai)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblTinTucCollection = new EntityCollection(new TblTinTucEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblTinTucFields.TrangThai == TrangThai);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblTinTucCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		

	}
}
